import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import path from 'path'
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [react()],
  server: {
    host: '0.0.0.0',
    port: 3000,
    open: true,
    proxy: {
      '/api': {
        target: 'https://www.fastmock.site/mock/a1bb80edd841687c0927cd459e4b712d',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, '/api'),
      }
    }
  },
  resolve: {
    alias: {
      '@': path.join(__dirname, 'src'),
      '@a': path.join(__dirname, 'src/api'),
      '@c': path.join(__dirname, 'src/components'),
      '@p': path.join(__dirname, 'src/pages'),
      '@s': path.join(__dirname, 'src/store'),
      '@u': path.join(__dirname, 'src/utils')
    }
  }
})
